<html>
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %>
<%@include file="/quick/include/common.jsp"%>
<%@include file="/quick/include/globalScope.jsp"%>
  <head>
    <title><c:out value="${model.title}"/></title>
  </head>
<script>
Ext.onReady(function(){
	var gradeStore=new Ext.data.SimpleStore({
     'fields':['value','text'],
     data:<c:out value="${model.gradeJson}" escapeXml='false' />
	});
	var yearCollegeStore=new Ext.data.SimpleStore({
     'fields':['value','text','group'],
     data:<c:out value="${model.yearCollegeJson}" escapeXml='false' />
	});
	var gradeMajorStore=new Ext.data.SimpleStore({
     'fields':['value','text','grade','refid'],
     data:<c:out value="${model.gradeMajorJson}" escapeXml='false' />
	});
    
	var form = new Ext.form.FormPanel({
	      labelAlign:'right',
	      title:"<c:out value='${model.graduateYear}' escapeXml='false'/>届毕业生审核",
	      labelWidth:80,
	      region:'north',
	      height:g_height/3,
	      frame:true,
	      width:320,
		  url:g_rootPath+'quick/quick.html',	      
	      items:[{
            xtype:'combo',   
            fieldLabel:'年级',   
            store: gradeStore,   
            editable: false,   
            hiddenName:'GRADE',   
            id:'_GRADE',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         },{
            xtype:'combo',   
            fieldLabel:'系',   
            store: yearCollegeStore,   
            editable: false,   
            hiddenName:'YEAR_COLLEGE',   
            id:'_YEAR_COLLEGE',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         },{
            xtype:'combo',   
            fieldLabel:'专业',   
            store: gradeMajorStore,   
            editable: false,   
            hiddenName:'GRADE_MAJOR',   
            id:'_GRADE_MAJOR',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         }],
         buttons:[{text:'确定',handler:function(){
           f_begin(form);
         }},{text:'重置',handler:function(){
           form.getForm().reset();
         }}] 
          
	});
	
	form.render('parameter_form');   
   
    var gradeCombo=form.getForm().findField('_GRADE');
    var yearCollegeCombo=form.getForm().findField('_YEAR_COLLEGE');
    var gradeMajorCombo=form.getForm().findField('_GRADE_MAJOR');
    
	 yearCollegeCombo.lastQuery="";
	 gradeMajorCombo.lastQuery="";
	 
	 gradeCombo.on('change',function(combo){
	   yearCollegeCombo.reset();
	   gradeMajorCombo.reset();
	 });
	 yearCollegeCombo.on('change',function(combo){
	   gradeMajorCombo.reset();
	 });
	 
	 yearCollegeCombo.on('focus',function(combo){	
	    var grade=gradeCombo.getValue();
	    yearCollegeCombo.store.filterBy(function(r){
	      if(r.get('group')==grade||r.get('group')=='null') return true;
	    }); 
	 });    
	 
	 gradeMajorCombo.on('focus',function(combo){	
	    var grade=gradeCombo.getValue();
	    var refid=yearCollegeCombo.getValue();
	    gradeMajorCombo.store.filterBy(function(r){
	      if((r.get('grade')==grade&&r.get('refid')==refid)||(r.get('grade')=='null'&&r.get('refid')=='null')) return true; 
	    }); 
	 });    
    

	var graduateYearStore=new Ext.data.SimpleStore({
     'fields':['value','text'],
     data:<c:out value="${model.graduateYearJson}" escapeXml='false' />
	});
	var form2 = new Ext.form.FormPanel({
	      labelAlign:'right',
	      title:"历届毕业生审核",
	      labelWidth:80,
	      region:'north',
	      height:g_height/5,
	      frame:true,
	      width:320,
		  url:g_rootPath+'quick/quick.html',	      
	      items:[{
            xtype:'combo',   
            fieldLabel:'毕业年份',   
            store: graduateYearStore,   
            editable: false,   
            hiddenName:'GRADUATE_YEAR',   
            id:'_GRADUATE_YEAR',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         }],
         buttons:[{text:'确定',handler:function(){
           f_begin2(form2);
         }},{text:'重置',handler:function(){
           form.getForm().reset();
         }}] 
          
	});
	
	form2.render('year_form');   

   
});

function f_begin(form){
  var graduateYear="<c:out value='${model.graduateYear}'/>";
  var grade=form.getForm().findField('_GRADE').getValue();
  var gradeMajor=form.getForm().findField('_GRADE_MAJOR').getValue();
  var gradeMajorName=form.getForm().findField('_GRADE_MAJOR').getRawValue();
  
  var matrix=[['GRADE',grade],['MAJOR',gradeMajor],['tableName',"T_GRADUATE"],['graduateYear',graduateYear]
              ,['gradeMajorName',gradeMajorName]];
  var form=createForm(g_rootPath+'quick/quick.html',matrix);
  form.submit();
}

function f_begin2(form){
  var graduateYear=form.getForm().findField('_GRADUATE_YEAR').getValue();
  var matrix=[['GRADUATE_YEAR',graduateYear],['graduateYear',graduateYear],['tableName',"T_GRADUATE"],['tableAlias',"T_GRUDUATE_UNDEGREE"]];
  var form=createForm(g_rootPath+'quick/quick.html',matrix);
  form.submit();
}

 
</script>  
    <c:if test="${not empty message}">
      <div  align="left" id="title" style="height:40px;vertical-align:bottom;bgcolor:blue;"><br><h3><STRONG><c:out value='${message}'/></STRONG></h3></div>
    </c:if>

<br>
<br>
<br>

<div id="parameter_form" align=center></div>  
<br>
<div id="year_form" align=center></div>  

  
</html>   
